<?php

/**
 * Members form base class.
 *
 * @method Members getObject() Returns the current form's model object
 *
 * @package    cpfaizenay
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseMembersForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_member'               => new sfWidgetFormInputHidden(),
      'pseudo'                  => new sfWidgetFormInputText(),
      'datetime_register'       => new sfWidgetFormDateTime(),
      'datetime_last_connexion' => new sfWidgetFormDateTime(),
      'email'                   => new sfWidgetFormInputText(),
      'password'                => new sfWidgetFormInputText(),
      'auto_redirect'           => new sfWidgetFormChoice(array('choices' => array('accueil' => 'accueil', 'site' => 'site', 'admin' => 'admin'))),
      'title'                   => new sfWidgetFormChoice(array('choices' => array('M.' => 'M.', 'Mme' => 'Mme', 'Mlle' => 'Mlle'))),
      'firstname'               => new sfWidgetFormInputText(),
      'lastname'                => new sfWidgetFormInputText(),
      'role'                    => new sfWidgetFormInputText(),
      'status'                  => new sfWidgetFormChoice(array('choices' => array('superAdmin' => 'superAdmin', 'admin' => 'admin', 'moderator' => 'moderator', 'captain' => 'captain'))),
      'main_group'              => new sfWidgetFormInputText(),
      'login_allowed'           => new sfWidgetFormChoice(array('choices' => array(0 => '0', 1 => '1'))),
      'picture'                 => new sfWidgetFormInputText(),
      'rights'                  => new sfWidgetFormTextarea(),
      'id_licensee'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Licensee'), 'add_empty' => true)),
      'id_file_avatar'          => new sfWidgetFormInputText(),
      'cookie_key'              => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id_member'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id_member')), 'empty_value' => $this->getObject()->get('id_member'), 'required' => false)),
      'pseudo'                  => new sfValidatorString(array('max_length' => 65)),
      'datetime_register'       => new sfValidatorDateTime(array('required' => false)),
      'datetime_last_connexion' => new sfValidatorDateTime(array('required' => false)),
      'email'                   => new sfValidatorString(array('max_length' => 128)),
      'password'                => new sfValidatorString(array('max_length' => 32)),
      'auto_redirect'           => new sfValidatorChoice(array('choices' => array(0 => 'accueil', 1 => 'site', 2 => 'admin'), 'required' => false)),
      'title'                   => new sfValidatorChoice(array('choices' => array(0 => 'M.', 1 => 'Mme', 2 => 'Mlle'), 'required' => false)),
      'firstname'               => new sfValidatorString(array('max_length' => 64)),
      'lastname'                => new sfValidatorString(array('max_length' => 64)),
      'role'                    => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'status'                  => new sfValidatorChoice(array('choices' => array(0 => 'superAdmin', 1 => 'admin', 2 => 'moderator', 3 => 'captain'), 'required' => false)),
      'main_group'              => new sfValidatorInteger(array('required' => false)),
      'login_allowed'           => new sfValidatorChoice(array('choices' => array(0 => '0', 1 => '1'))),
      'picture'                 => new sfValidatorInteger(array('required' => false)),
      'rights'                  => new sfValidatorString(array('required' => false)),
      'id_licensee'             => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Licensee'), 'required' => false)),
      'id_file_avatar'          => new sfValidatorInteger(array('required' => false)),
      'cookie_key'              => new sfValidatorString(array('max_length' => 32, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('members[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Members';
  }

}
